# 869. 重新排序得到 2 的幂
#

################################################################################


class Solution:
    def reorderedPowerOf2(self, n: int) -> bool:

        targets = set()
        for i in range(32):
            targets.add("".join(sorted(str(2 ** i))))

        # targets = {
        #     "23",
        #     "01466788",
        #     "2",
        #     "0112344778",
        #     "23334455",
        #     "4",
        #     "1",
        #     "256",
        #     "128",
        #     "16",
        #     "11266777",
        #     "35566",
        #     "012356789",
        #     "1234446788",
        #     "23678",
        #     "8",
        #     "0124",
        #     "13468",
        #     "0469",
        #     "234455668",
        #     "122446",
        #     "1289",
        #     "46",
        #     "011237",
        #     "0368888",
        #     "112234778",
        #     "0248",
        #     "0145678",
        #     "125",
        #     "0134449",
        #     "0122579",
        #     "224588",
        # }

        tmp = "".join(sorted(str(n)))
        return tmp in targets


################################################################################


if __name__ == "__main__":
    solution = Solution()
    print(solution.reorderedPowerOf2(1))
